<#escape x as x?html>
<div class="bjui-pageContent">
    <form action="${ctx}/system/role/edit" class="pageForm" data-toggle="validate" data-reload-navtab="false" data-callback="editCallback">
        <input type="hidden" name="roleId" value="${role.roleId}">
        <input type="hidden" name="resourceIds" value="${resourceIds!}" id="resourceIds">
        <ul class="nav nav-tabs" role="tablist">
		    <li class="active"><a href="#roleInfo" role="tab" data-toggle="tab">基本信息</a></li>
		    <li><a href="#roleResource" role="tab" data-toggle="tab">角色资源</a></li>
		</ul>
		<div class="tab-content">
			<div class="tab-pane fade active in" id="roleInfo">
		    	 <table class="table table-bordered table-condensed">
		            <tbody>
		            <tr>
		                <td>
		                    <label for="roleName" class="control-label x90">角色名称：</label>
		                    <input type="text" name="roleName" id="roleName" value="${role.roleName}" data-rule="required" size="20">
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    <label for="roleDesc" class="control-label x90">角色描述：</label>
		                    <input type="text" name="roleDesc" id="roleDesc" value="${role.roleDesc}" data-rule="required" size="20">
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    <label for="available" class="control-label x90">状态：</label>
		                    <@h.select name="available" list=fn.getDicValue('AVAILABLE_STATUS') value=role.available/>
		                </td>
		            </tr>
		            </tbody>
		        </table>    
			</div>
	    	<div class="tab-pane fade" id="roleResource">
	    	    <ul id="layout-tree-1" data-on-check="nodeOnCheck"  data-check-enable="true"  class="ztree" data-toggle="ztree" data-expand-all="true">
			        <#list resourceList as resource> 
			           	<li data-checked="${resource.checked?c}" data-id="${resource.resourceId}" data-pid="${resource.parentId}">${resource.resourceName}</li>
			        </#list>              
			    </ul>
	    	</div>
		</div>
    </form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li>
            <button type="button" class="btn-close">关闭</button>
        </li>
        <li>
            <button type="submit" class="btn-green">保存</button>
        </li>
    </ul>
</div>
<script type="text/javascript">
//选择事件
function nodeOnCheck(e, treeId, treeNode) {
    var zTree = $.fn.zTree.getZTreeObj(treeId);
    var nodes = zTree.getCheckedNodes(true);
    var ids = '';
    for (var i = 0; i < nodes.length; i++) {
        ids   += ','+ nodes[i].id;
    }
    if (ids.length > 0) {
        ids = ids.substr(1);
    }
   // alert(ids);
   $('#resourceIds').val(ids);
  
    //var $from = $('#'+ treeId).data('fromObj')
    
    //if ($from && $from.length) $from.val(names)
}
</script>
</#escape>